package com.pattern.twice;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class R {

    public static void main(String[] args) {
        I i = (I) Proxy.newProxyInstance(I.class.getClassLoader(), new Class[]{I.class}, new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                System.out.println("1");
                System.out.println(method.getName());
                System.out.println("2");
                return "wwwwwwwwwwwwww";
            }
        });
        System.out.println(i.b());
    }



}
interface I {
    public void a();
    public String b();
    public void c();
}